<?php

namespace App\Http\Controllers;

use App\Http\Controllers\BaseController;
use App\Services\ActivityFormService;
use Illuminate\Http\Request;

class ActivityFormController extends BaseController
{
    public function __construct(ActivityFormService $activityFormService)
    {
        $this->middleware('check.login')->except('index');

        $this->activityFormService = $activityFormService;
    }

    public function store(Request $request)
    {
        $param = $this->validationParameter([
            'activity_id|活动id' => 'require',
            'name|姓名' => 'require',
            'sex|性别' => 'require',
            'phone|手机' => 'require',
            'id_card|身份证号' => 'require',
        ]);
        $param['add_uid'] = $request->user('api')->user_id ?? null;

        $result = $this->activityFormService->add($param);

        return $this->response->success($result);
    }

    public function my(Request $request)
    {
        $param['add_uid'] = $request->user('api')->user_id ?? null;
        
        $result = $this->activityFormService->getList($param);

        return $this->response->success($result);

    }

}
